export const webList = (self, tiyData) => {
  self.loadingData = true;
  self.$Spin.show();
  let data = {
    "choosedClassify":tiyData.tParam.selectedClassification,
    "classifyLevel":tiyData.tParam.classificationLevel,
    "state":tiyData.tParam.state,
    "pageSize": tiyData.tPage.stepNumber,
    "pageNum": tiyData.tPage.currentPage,
    "productCode" :tiyData.tParam.productCode
  };
  tiyData.tData.colorList.splice(0);
  self.$apiProduct.getStockEmpty(data).then(function (response) {
    // tiyData.tData.colorList.splice(0, tiyData.tData.colorList.length);
    if(response.success){
      tiyData.tPage.total = response.result.total;
      tiyData.tPage.stepNumber = response.result.pageSize;
      response.result.list.forEach(function(item){
        tiyData.tData.colorList.push(item);
      });
    }else{
      self.$Message.error(response.errorMessage);
    }
    self.$Spin.hide();
  })
};

export const init = (self, tiyData) => {
  tiyData.tPage.currentPage = 1;
  tiyData.tPage.total = 0;
  tiyData.tParam.selectedClassification = '';
  tiyData.tParam.classificationLevel = 0;
  tiyData.tParam.productCode = "";
};

export const edit=(index,tiyData)=>{
  let row =tiyData.tData.tabList[index];
  tiyData.tParam.tab={id:row.id,name:row.name,icon:row.icon}
  tiyData.addModal.isShow=true;
};

